package com.ad_hccm.dao.GeneralInformation;

import com.ad_hccm.domain.GeneralInformation.GeneralInformation;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * TODO 一般资料Dao
 */
@Mapper
public interface GeneralInformationDao {
    @Insert("insert into general_information value(#{id},#{birthDate},#{age},#{nation},#{marriage},#{height},#{weight},#{education},#{career},#{longTermResidence},#{environment},#{isSmoke},#{isDrink},#{motion},#{eatingHabits},#{isMedicine},#{isOuterMedicineOne},#{isOuterMedicineTwo})")
    public boolean save(GeneralInformation generalInformation);

    @Update("update general_information set birthDate = #{birthDate}, age = #{age}, nation = #{nation}, marriage = #{marriage}, height = #{height}, weight = #{weight}, education = #{education}, career = #{career}, longTermResidence = #{longTermResidence}, environment = #{environment}, isSmoke = #{isSmoke}, isDrink = #{isDrink}, motion = #{motion}, eatingHabits = #{eatingHabits}, isMedicine = #{isMedicine}, isOuterMedicineOne = #{isOuterMedicineOne}, isOuterMedicineTwo = #{isOuterMedicineTwo} where id=#{id}")
    public boolean update(GeneralInformation generalInformation);

    @Select("select * from general_information where id=#{id}")
    public GeneralInformation getById(String id);

    @Select("select * from general_information")
    public List<GeneralInformation> getAll();
}
